Skip to content

Conversation

@jinhoon227
Copy link
Collaborator

@jinhoon227 jinhoon227 commented Nov 27, 2024

변경사항

  • 불필요한 파일 제거
  • 푸쉬알람을 위한 파일 추가
  • 푸쉬알람 FCM 키 추가를 위한 CI/CD 수정

참고사항

FCM 을 이용하여 푸쉬알람 구현

FCM 토큰을 이용해서 푸쉬알람을 구현합니다. FCM 토큰의 경우 "디바이스" 를 식별할 수 있습니다. 디바이스로 식별하기에 하나의 유저는 여러개의 디바이스를 보유하고 있다면, 여러 개의 토큰을 가질 수 있습니다.

아키텍처는 아래와 같습니다.
클라이언트는 백엔드서버에 유저의 FCM 토큰 등록을 요청합니다. 최초로 토큰 등록 요청이라면 모든 알람을 허용한 상태로 설정하고, 이미 등록된 토큰이라면 토큰을 로그인상태로 설정합니다.

그리고 푸쉬 알람 요청 발생시, 요청 대상이 되는 FCM 토큰이 존재하고 알람을 허용한 상태라면 알람을 보냅니다. 여기서 백엔드는 파이어베이스에 푸쉬알람을 보내달라고 요청합니다. 그러면 파이어베이스가 토큰값을 통해 해당 기기에 푸쉬알람을 보냅니다. 이 알람은 클라이언트가 받아서 푸쉬알람을 띄웁니다.

그리고 사용자가 로그아웃하면 백엔드에서 토큰을 로그아웃 상태로 설정하여 알람을 받지 않도록 합니다. 이렇게하면 사용자가 공장초기화를 하고 기기를 팔아서 기기 주인이 바뀌어도 알람을 보내지 않습니다.

@jinhoon227 jinhoon227 added the enhancement New feature or request label Nov 27, 2024
@jinhoon227 jinhoon227 self-assigned this Nov 27, 2024
@jinhoon227 jinhoon227 changed the base branch from main to develop November 27, 2024 12:04
…to feature/fcm-push-alarm(#240)

# Conflicts:
#	build.gradle
#	src/main/java/zip/ootd/ootdzip/fcm/service/FcmService.java
* Firebase Admin SDK의 비공개 키를 참조하여 Bearer 토큰을 발급 받습니다.
*/
private String getAccessToken() {
String firebaseConfigPath = "firebase/ootdzip-cf27f-firebase-adminsdk-iuig1-8969152a6a.json";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: 설정 파일로 분리하는게 낫지 않을까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

설정 분리 했습니다!

@jinhoon227 jinhoon227 merged commit a65bc65 into develop Dec 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants